package com.cskaoyan.day1.collection;

import java.util.ArrayList;
import java.util.Collection;

/**
 * @author Common-zhou
 * @since 2023-02-27 16:41
 */
public class CollectionDemo2 {
    public static void main(String[] args) {
        // 1.班上有5个同学。  学生需要存储名字，年龄
        Collection<Student> collection = new ArrayList<>();

        Student student = new Student("张三丰", 100);
        collection.add(student);
        collection.add(new Student("张无忌", 24));
        collection.add(new Student("白猫鹰王", 50));
        collection.add(new Student("金毛狮王", 70));
        collection.add(new Student("东方不败", 20));

        System.out.println(collection);

        // 2.现在转学走了一个同学。  怎么表示
        collection.remove(student);
        System.out.println(collection);

        // 3.新学期，又来了三个学生  怎么表示
        collection.add(new Student("zs", 19));
        collection.add(new Student("ls", 20));
        collection.add(new Student("zl", 20));
        System.out.println(collection);
    }
}
